#include "MessageCallbackEvent.h"
#include <wx/log.h>

namespace Impp{

// in der TurnEvent.cpp muss nun 'nur' noch der Event Definiert werden:
DEFINE_EVENT_TYPE(EVT_MESSAGE_CALLBACK) 

MessageCallbackEvent::MessageCallbackEvent(ActionId mid,Buddy* buddy, MessageState state, MessageError error, const wxString & errString, wxEventType eventType, int id):
	wxNotifyEvent(eventType,id),
	id(mid),
	buddy(buddy),
	state(state),
	error(error),
	errString(errString)
{
}

MessageCallbackEvent::~MessageCallbackEvent()
{
}

wxEvent* MessageCallbackEvent::Clone() const {
	return new MessageCallbackEvent(*this);
};

MessageState MessageCallbackEvent::getState(){
	return state;
}

MessageError MessageCallbackEvent::getError(){
	return error;
}

wxString MessageCallbackEvent::getErrorString(){
	if(!errString.IsEmpty()){
		return errString;
	}
	
	switch(error){
	case MESSAGE_ERROR_NO:
		return wxT("No Error");
	case MESSAGE_ERROR_SELF_OFFLINE:
		return wxT("You are not Online");
	case MESSAGE_ERROR_BUDDY_OFFLINE:
		return wxT("Buddy is not Online");
	case MESSAGE_ERROR_TOO_LONG:
		return wxT("The Message is To Long");
	case MESSAGE_ERROR_ILLEGAL_CHAR:
		return wxT("Your Message contains a Illegal Character");
	case MESSAGE_ERROR_OTHER:
		wxLogDebug(wxT("MessageCallbackEvent::getErrorString: No Error String"));
		return wxT("Unknown Error");
	}
	return wxEmptyString;
}

Buddy* MessageCallbackEvent::getBuddy(){
	return buddy;
}

int MessageCallbackEvent::getId(){
	return id;
}

}
